package com.rover022.flixelgame.ui
{
	import com.greensock.events.LoaderEvent;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	
	import ghostcat.display.GBase;
	import ghostcat.ui.PopupManager;

	/**
	 * 基本的UI类 其他的一切UI应该是他的子类
	 * @author flashpig
	 *
	 */
	public class BaseUI extends Sprite
	{
		public var assetUI:MovieClip;

		public function BaseUI( )
		{
			 
			addEventListener(Event.REMOVED_FROM_STAGE, removeStageHandle);
		}

		protected function removeStageHandle(event:Event):void
		{
			if (stage)
			{
				stage.focus = stage;
			}
			removeEventListener(Event.ADDED_TO_STAGE, removeStageHandle);
			dispose();
		}

		public function dispose():void
		{
		}

		/**
		 * 面板的初始化行为
		 */
		public function initUI(e:LoaderEvent = null):void
		{
			// TODO Auto Generated method stub
		}

		/**
		 * 弹出类型的面板关闭行为
		 */
		public function close(e:Event = null):void
		{
			PopupManager.instance.removePopup(this);
		}

		public function update():void
		{
		}
	}
}
